
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> zz <- file.path("U:","My Documents")
> 
> File.Location <- file.path(zz,"BALANCED.sav")
> library(foreign)
> y <- read.spss(File.Location)
> y <- data.frame(y)
> attach(y)
> regout <- lm(score ~ task*group,data=y)
> anova(regout)
Analysis of Variance Table

Response: score
           Df Sum Sq Mean Sq F value    Pr(>F)    
task        3 127.38   42.46  15.120 4.650e-07 ***
group       2 640.03  320.02 113.953 < 2.2e-16 ***
task:group  6 486.77   81.13  28.888 2.388e-14 ***
Residuals  48 134.80    2.81                      
---
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1
> 
> # group means
> 
> install.packages("plyr")
Installing package into C:/Users/peterw/Documents/R/win-library/3.6
(as lib is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in contrib.url(repos, "source") : 
  trying to use CRAN without setting a mirror
> library(plyr)
Warning message:
package plyr was built under R version 3.6.3 
> ddply(y,.(group),summarise,mean=mean(score),sd=sd(score))
            group  mean       sd
1 PATIENT GROUP 1 15.05 3.456116
2 PATIENT GROUP 2 11.00 3.145590
3        CONTROLS 19.00 4.192726
> 
> # unpacking interactions as simple effects
> 
> install.packages("emmeans")
Installing package into C:/Users/peterw/Documents/R/win-library/3.6
(as lib is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in contrib.url(repos, "source") : 
  trying to use CRAN without setting a mirror
> library(emmeans)
Warning message:
package emmeans was built under R version 3.6.3 
> emcatcat <- emmeans(regout, ~ task*group, data=y)
> contrast(emcatcat, "revpairwise",by="group",adjust="none")
group = PATIENT GROUP 1:
 contrast            estimate   SE df t.ratio p.value
 OBJECTS - ANIMALS        0.8 1.06 48  0.755  0.4541 
 PLANTS - ANIMALS         2.8 1.06 48  2.642  0.0111 
 PLANTS - OBJECTS         2.0 1.06 48  1.887  0.0652 
 COUNTRIES - ANIMALS      7.8 1.06 48  7.359  <.0001 
 COUNTRIES - OBJECTS      7.0 1.06 48  6.605  <.0001 
 COUNTRIES - PLANTS       5.0 1.06 48  4.718  <.0001 

group = PATIENT GROUP 2:
 contrast            estimate   SE df t.ratio p.value
 OBJECTS - ANIMALS       -1.0 1.06 48 -0.944  0.3501 
 PLANTS - ANIMALS         3.0 1.06 48  2.831  0.0068 
 PLANTS - OBJECTS         4.0 1.06 48  3.774  0.0004 
 COUNTRIES - ANIMALS      6.0 1.06 48  5.661  <.0001 
 COUNTRIES - OBJECTS      7.0 1.06 48  6.605  <.0001 
 COUNTRIES - PLANTS       3.0 1.06 48  2.831  0.0068 

group = CONTROLS:
 contrast            estimate   SE df t.ratio p.value
 OBJECTS - ANIMALS       -8.0 1.06 48 -7.548  <.0001 
 PLANTS - ANIMALS        -6.0 1.06 48 -5.661  <.0001 
 PLANTS - OBJECTS         2.0 1.06 48  1.887  0.0652 
 COUNTRIES - ANIMALS    -10.0 1.06 48 -9.435  <.0001 
 COUNTRIES - OBJECTS     -2.0 1.06 48 -1.887  0.0652 
 COUNTRIES - PLANTS      -4.0 1.06 48 -3.774  0.0004 

> > emcatcat
 task      group           emmean    SE df lower.CL upper.CL
 ANIMALS   PATIENT GROUP 1   12.2 0.749 48    10.69    13.71
 OBJECTS   PATIENT GROUP 1   13.0 0.749 48    11.49    14.51
 PLANTS    PATIENT GROUP 1   15.0 0.749 48    13.49    16.51
 COUNTRIES PATIENT GROUP 1   20.0 0.749 48    18.49    21.51
 ANIMALS   PATIENT GROUP 2    9.0 0.749 48     7.49    10.51
 OBJECTS   PATIENT GROUP 2    8.0 0.749 48     6.49     9.51
 PLANTS    PATIENT GROUP 2   12.0 0.749 48    10.49    13.51
 COUNTRIES PATIENT GROUP 2   15.0 0.749 48    13.49    16.51
 ANIMALS   CONTROLS          25.0 0.749 48    23.49    26.51
 OBJECTS   CONTROLS          17.0 0.749 48    15.49    18.51
 PLANTS    CONTROLS          19.0 0.749 48    17.49    20.51
 COUNTRIES CONTROLS          15.0 0.749 48    13.49    16.51

Confidence level used: 0.95 
